package com.hgkj.cloud.base.service.impl;

import com.hgkj.cloud.base.common.PageInfo;
import com.hgkj.cloud.base.dao.SysTestingQuestionMapper;
import com.hgkj.cloud.base.domain.SysTestingQuestion;
import com.hgkj.cloud.base.service.SysTestingQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SysTestingQuestionServiceImpl implements SysTestingQuestionService {

    @Autowired
    private SysTestingQuestionMapper sysTestingQuestionMapper;

    @Override
    public List<SysTestingQuestion> getQuestionsById(Map<String, Integer> map) {
        try {
            return sysTestingQuestionMapper.getQuestionsById(map);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return null;
        }
    }

    @Override
    public List<SysTestingQuestion> listTesting(Map<String, Object> map, PageInfo pi) {
        // TODO Auto-generated method stub
        int currentCount = pi.getCurrentCount();
        int pageSize = pi.getPageSize();
        map.put("currentCount", currentCount);
        map.put("pageSize", pageSize);
        return sysTestingQuestionMapper.listTesting(map);
    }

    @Override
    public SysTestingQuestion getQuestionById(int id) {
        return sysTestingQuestionMapper.getQuestionById(id);
    }

    @Override
    public int updateQuestion(SysTestingQuestion tq) {
        return sysTestingQuestionMapper.updateQuestion(tq);
    }

    @Override
    public int deleteQuestion(int id) {
        return sysTestingQuestionMapper.deleteQuestion(id);
    }

    @Override
    public int insertQuestion(SysTestingQuestion question) {
        // TODO Auto-generated method stub
        return sysTestingQuestionMapper.insertQuestion(question);
    }

    @Override
    public List<Map<String, Object>> findQuestionnaireAllInfosByTableUuid(String qnid) {
        return sysTestingQuestionMapper.findQuestionnaireAllInfosByTableUuid(qnid);
    }

}
